#pragma once

#include "hloop.h"
#include "hmain.h"
#include "iniparser.h"

typedef struct conf_ctx_s {
    IniParser* parser;
    int loglevel;
    int service_port;
    int czgw_port;
    std::string basedir;
    std::string log_path;
    std::string db_path;
    std::string dist_path;
    std::string records_path;
    std::string snapshot_path;
    int log_fsync;
    int records_size  = 1;  //GB
    int snapshot_size = 1;  //GB
} conf_ctx_t;

extern conf_ctx_t g_conf_ctx;

void conf_ctx_init(conf_ctx_t* ctx);

void mylogger(int loglevel, const char* buf, int len);

int parse_confile(const char* confile);

void print_version();

void print_help(const option_t* long_options, int opt_size);

void on_signal(hsignal_t* sig);
